angular.module('starter.controllers', [])

    .controller('AppCtrl', ['$scope', function ($scope, $state) {

        $scope.notifyMe = function() {
            // Let's check if the browser supports notifications
            if (!("Notification" in window)) {
                alert("This browser does not support desktop notification");
            }

            // Let's check if the user is okay to get some notification
            else if (Notification.permission === "granted") {
                // If it's okay let's create a notification
                var notification = new Notification("Hi there!");
            }

            // Otherwise, we need to ask the user for permission
            // Note, Chrome does not implement the permission static property
            // So we have to check for NOT 'denied' instead of 'default'
            else if (Notification.permission !== 'denied') {
                Notification.requestPermission(function (permission) {

                    // Whatever the user answers, we make sure we store the information
                    if(!('permission' in Notification)) {
                        Notification.permission = permission;
                    }

                    // If the user is okay, let's create a notification
                    if (permission === "granted") {
                        var notification = new Notification("Hi there!");
                    }
                });
            }

            // At last, if the user already denied any notification, and you
            // want to be respectful there is no need to bother him any more.
        }

        /*
         * if given group is the selected group, deselect it
         * else, select the given group
         */
        $scope.toggleGroup = function (group) {

            if ($scope.isGroupShown(group)) {
                $scope.shownGroup = null;
            } else {
                $scope.shownGroup = group;
            }
        };
        $scope.isGroupShown = function (group) {
            return $scope.shownGroup === group;
        };
    }])

    .controller('learnController', function ($scope, $stateParams) {

    })
    .controller('prepareController', function ($scope, $stateParams) {
        $scope.changeStatusChecklist = function(item){
        };

        $scope.checkList_hoahoan =
            [
                {_id: "1", content: "Cua thoat hiem", status: true},
                {_id: "2", content: "Binh chua chay", status: false},
                {_id: "3", content: "Cong an", status: false}
            ];

    });

